package com.cfs.svcimpl.sys;

import java.util.List;

import com.cfs.dao.sys.RoleDao;
import com.cfs.svc.sys.RoleService;
import com.cfs.po.sys.LongId;
import com.cfs.po.sys.Right;
import com.cfs.po.sys.Role;

/**
 *	角色管理服务类
 *	@author wang.yujie
 * 	@since 2012-12-23
 *	@version 1.0
 */
public class RoleServiceImpl implements RoleService {

	private RoleDao dao = null;
	
	public RoleDao getDao() {
		return dao;
	}

	public void setDao(RoleDao dao) {
		this.dao = dao;
	}

	@Override
	public int add(Role[] roles) {
		return dao.add(roles);
	}

	/**
	 * POST
	 * 删除操作，可批量删除
	 * @param ids 包装了一个ids[]数组
	 * @return
	 */
	@Override
	public int delete(LongId ids) {
		return dao.delete(ids.getIds());
	}

	@Override
	public int update(Role[] roles) {
		return dao.update(roles);
	}

	@Override
	public int update(Long roleId, List<Right> rights){
		return dao.updateRight(roleId, rights);
	}

	

	@Override
	public Role get(long id) {
		return dao.query(id);
	}

	@Override
	public List<Right> getRights(Long roleid) {
		return dao.queryRights(roleid);
	}

	@Override
	public List<Right> getAllRights() {
		return dao.queryAllRights();
	}

	@Override
	public List<Role> list(int level) {
		return dao.list(level);
	}
	@Override
	public List<Role> lists(int level) {
		return dao.lists(level);
	}

}
